package com.lightsaber.trade.cloth.service.planning.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.lightsaber.trade.core.dao.BaseDao;
import com.lightsaber.trade.core.service.HppBaseServiceImpl;
import com.lightsaber.trade.cloth.dao.planning.ResourceGroupItemDao;
import com.lightsaber.trade.cloth.entity.planning.ResourceGroupItem;
import com.lightsaber.trade.cloth.service.planning.ResourceGroupItemService;

@Service
@Component
@Transactional
public class ResourceGroupItemServiceImpl extends HppBaseServiceImpl<ResourceGroupItem, String>
        implements ResourceGroupItemService {

    @Autowired
    private ResourceGroupItemDao resourceGroupItemDao;

    @Override
    protected BaseDao<ResourceGroupItem, String> getDao() {
        return resourceGroupItemDao;
    }

    @Override
    public void save(final ResourceGroupItem resourceGroupItem) {
        resourceGroupItemDao.save(resourceGroupItem);
    }

    @Override
    public void deleteByResourceGroupId(final String resourceGroupId) {
        resourceGroupItemDao.deleteByResourceGroupId(resourceGroupId);
    }

    @Override
    public List<ResourceGroupItem> findByResourceGroupId(final String resourceGroupId) {
        return resourceGroupItemDao.findBy("resourceGroup.id", resourceGroupId);
    }
}
